package com.wlyuan.open.scanner.controller;

import com.wlyuan.open.scanner.service.InitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lijing
 * @description
 */
@Api(tags = "初始化")
@Validated
@RequestMapping("/init")
@RestController
@Slf4j
public class InitController {
    @Autowired
    private InitService initService;

    @ApiOperation("初始化收付款数据")
    @PostMapping("/pay")
    public void pay() {
        initService.pay();
    }

    @ApiOperation("初始化运单数据")
    @PostMapping("/waybill")
    public void waybill() {
        initService.waybill();
    }

    @ApiOperation("初始对账单数据")
    @PostMapping("/bill")
    public void bill() {
        initService.bill();
    }

    @PostMapping("/waybillTime")
    public void waybillTime(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) {
        initService.waybillTime(startTime, endTime);
    }

    @PostMapping("/billTime")
    public void billTime(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) {
        initService.billTime(startTime, endTime);
    }

    @PostMapping("/payTime")
    public void payTime(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) {
        initService.payTime(startTime, endTime);
    }
}
